/*年轻人，只管向前看，不要管自暴自弃者的话*/
package com.composetest.page.guide.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import com.composetest.page.guide.GuideRoute
import com.composetest.page.splash.navigation.SPLASH_ROUTE
import com.composetest.ui.navigation.myComposable

const val GUIDE_ROUTE = "guide"

/**
 * 跳转到guide
 */
fun NavController.navigationToGuide(): Unit {
    navigate(GUIDE_ROUTE) {
        launchSingleTop = true
        // 关闭启动页面 + 启动页面之前页面
        popUpTo(SPLASH_ROUTE) {
            inclusive = true
        }
    }
}

/**
 * 配置导航
 */
fun NavGraphBuilder.guideScreen(toBack: () -> Unit): Unit {
    myComposable(GUIDE_ROUTE) {
        GuideRoute(toBack = toBack)
    }
}
